fs: Prevent overflows when assigning returned values from read_number()
authorLidong Chen <lidong.chen@oracle.com>
Tue, 21 Jan 2025 19:02:38 +0000 (19:02 +0000)
committerFelix Zielcke <fzielcke@z-51.de>
Thu, 3 Jul 2025 16:35:51 +0000 (18:35 +0200)
commit9a7b02e1ff49ad58da69484858055522a58ba8f3
tree0fcc83b10cca84ea460d3f0e9a4cefb3eea88e00
parent93ca65a0f8211c3a292dae29ffede31fc95e9ed9
fs: Prevent overflows when assigning returned values from read_number()

The direct assignment of the unsigned long long value returned by
read_number() can potentially lead to an overflow on a 32-bit systems.
The fix replaces the direct assignments with calls to grub_cast()
which detects the overflows and safely assigns the values if no
overflow is detected.

Signed-off-by: Lidong Chen <lidong.chen@oracle.com>
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
Gbp-Pq: Topic cve-2025-jan
Gbp-Pq: Name fs-Prevent-overflows-when-assigning-returned-values-from-.patch
grub-core/fs/cpio_common.c
grub-core/fs/tar.c